package com.aoxin.controller.client;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.aoxin.model.SlfVideo;
import com.aoxin.service.inter.course.systemCourse.SchoolCourseService;
import com.aoxin.service.inter.course.systemCourse.SyllabusService;
import com.aoxin.service.inter.course.webCourse.ArticleService;
import com.aoxin.service.inter.course.webCourse.VideoService;
import com.aoxin.util.AjaxRes;
import com.aoxin.util.Const;
import com.aoxin.util.enumerate.OperateType;
import com.aoxin.util.enumerate.UserType;
import com.aoxin.util.log.LogInfo;

@Controller
@ResponseBody
@RequestMapping("/web/find/")
public class FindController {

	@Autowired
	private SchoolCourseService schoolCourseService;

	@Autowired
	private VideoService videoService;

	@Autowired
	private ArticleService slfArticleService;

	@Autowired
	private SyllabusService syllabusService;



	@RequestMapping("displayVideo")
	@LogInfo(operateType = OperateType.QUERY, content = "视频展示", userType = UserType.USER)
	public AjaxRes displayVideo(SlfVideo slfVideo, AjaxRes ajaxRes) {
        try {
            List<SlfVideo> slfVideos = new ArrayList<SlfVideo>();
            slfVideos = videoService.displayVideo(slfVideo);

            if (slfVideos != null) {
                ajaxRes.setSucceed(slfVideos, Const.DATA_SUCCEED);
            } else {
                ajaxRes.setFailMsg(Const.DATA_FAIL);
            }
        } catch (Exception e) {
            ajaxRes.setSucceed(slfVideo, Const.DATA_SUCCEED);
        }
        return ajaxRes;
    }

}
